home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
kermit.columbia.edu
/
kermit.columbia.edu.tar
/
kermit.columbia.edu
/
newsgroups
/
misc.20020314-20021006
/
000371_mswarbrick@rentokil.com_Wed Sep 18 09:27:51 EDT 2002.msg
< prev
next >
Wrap
Text File
|
2002-10-06
|
4KB
|
107 lines
Article: 13705 of comp.protocols.kermit.misc
Path: newsmaster.cc.columbia.edu!panix!bloom-beacon.mit.edu!newsfeed.stanford.edu!postnews1.google.com!not-for-mail
From: mswarbrick@rentokil.com (Mark Swarbrick)
Newsgroups: comp.protocols.kermit.misc
Subject: Re: scripting to a serial sms modem - idiot question!
Date: 18 Sep 2002 04:09:11 -0700
Organization: http://groups.google.com/
Lines: 88
Message-ID: <e516d9ec.0209180309.320f7dad@posting.google.com>
References: <e516d9ec.0209160537.450ca7b@posting.google.com> <am4nq6$p5i$1@watsol.cc.columbia.edu>
NNTP-Posting-Host: 213.2.60.82
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1032347351 8578 127.0.0.1 (18 Sep 2002 11:09:11 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 18 Sep 2002 11:09:11 GMT
Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:13705
> Read it, finish your script, then send it in and we'll include it in the
> script library since SMS seems to be such a popular service these days.
Hello.
I have finished the script. I'm very sorry for asking about 'connect'
i bet you get fed up of that one. I had realised connect wouldn't
work, but wasn't getting any joy out of the output command as i needed
to send control chars etc and the modem didn't like the fast char rate
either!
The modem used is a siemens tc35 terminal. SMS commands may vary. I am
now working on two way scripts so that actions can be performed on the
pc depending on the text of a message, then a specific message sent
back. Eg if i text uptime to the sms box, i want a text message back
with the uptime of the server. Now i've just got to learn some more
i/o commands!
The setup is primative, but it's just to test basic functionality and
i'm sure an event based setup would be a lot better but...
There is a website which has two dialogue boxes for number and
message. This will then write a physical file on the outward facing
webserver. This file contains the number and message wrapped with the
correct string
eg lineout at+cmgs"+44123456789"
The internal machine with the sms modem attached runs a script from a
cron every minute.
-----------
#!/bin/bash
#runs ftp commands from the ftpget file to get msg file off remote
webserver
/bin/cat /tmp/ftpget | /usr/bin/ftp -i -n
#runs another script which appends a header and footer to the message
file. The #header is just stuff like the kerbang line and setting the
modem port/speed #etc. The footer is simply a quit statement.
/tmp/batchscript.sh
#outbox.sms is created which contains the full command list needed to
send the #sms
chmod +x /tmp/outbox.sms
#Execute the kermit kebang script
/tmp/outbox.sms
echo y|rm /tmp/outbox.sms
-------------
The final outbox.sms file looks like this:
#!/usr/bin/kermit
set modem type usr
set line /dev/ttyS0
set speed 9600
set carrier-watch off
set input echo on
lineout at
input 20 ok
lineout AT+CMGF=1
input 20 ok
lineout AT+CMGS="+447747603208"^M
input 20 >^M
lineout 1^M
output \26^M
input 100 ok
lineout AT+CMGS="+447747603208"^M
input 20 >^M
lineout 2^M
output \26^M
input 100 ok
lineout AT+CMGS="+447747603208"^M
input 20 >^M
lineout 3^M
output \26^M
quit
In this example 3 messages are sent, with the text '1','2','3'
respectively.
I'm sure my code is crap and there is an easier way to do it, but i'm
new to scripting so go easy!
hope this helps someone, let me know what you think frank and if
you've got any links that might be useful!